package com.ruoyi.system.feign.factory;

import com.ruoyi.system.feign.RemoteFileService;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Slf4j
@Component
public class RemoteFileFallbackFactory implements FallbackFactory<RemoteFileService> {
    @Override
    public RemoteFileService create(Throwable throwable) {
        log.error(throwable.getMessage());
        return new RemoteFileService() {

            @Override
            public Object fileDownload(Long fileid, Long userId, HttpServletResponse response, HttpServletRequest request) {
                return null;
            }

            @Override
            public String upload(MultipartFile file) {
                return null;
            }
        };
    }
}
